package com.csy.client_server.client_side;

import java.io.IOException;
import java.net.Socket;

public class MultiClient
{
    private static StringBuffer name;
    Socket socket= null;
    public MultiClient()
    {
        this.name=name;
        //客户端连接服务器端,返回Socket对象
        try
        {
            socket = new Socket("127.0.0.1",6666);
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        //创建读取服务器端信息的线程和发送服务器端信息的线程
        Thread read=new Thread(new ClientReadServer(socket));
        Thread send=new Thread(new ClientSendServer(socket,name));
        //启动线程
        read.start();
        send.start();
    }
    public static void main(String[] args) throws IOException
    {
        //客户端连接服务器端,返回Socket对象
        Socket socket=new Socket("127.0.0.1",6666);
        //创建读取服务器端信息的线程和发送服务器端信息的线程
        Thread read=new Thread(new ClientReadServer(socket));
        Thread send=new Thread(new ClientSendServer(socket,name));
        //启动线程
        read.start();
        send.start();
    }
}